package com.hexinfo.dmpro.dev.data.transfer.common;

import com.hexinfo.dmpro.dev.data.transfer.service.ICleanFtpFileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@EnableAsync
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CleanFtpFileApplicationRunner implements ApplicationRunner {

    private final ICleanFtpFileService cleanFtpFileService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        try {
            cleanFtpFileService.cleanFtpFile();
        } catch (Exception e) {
            log.error("开启ftp检查异常");
        }
    }
}
